

//
//  ClickQueryCell.m
//  PropertyMananger
//
//  Created by Mansion on 17/2/23.
//  Copyright © 2017年 BH. All rights reserved.
//

#import "ClickQueryCell.h"

@implementation ClickQueryCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
+ (instancetype)cellWithTableView:(UITableView *)tableView
{
    static NSString * CellID = @"ClickQueryCellID";
    ClickQueryCell * cell = [tableView dequeueReusableCellWithIdentifier:CellID];
    if (!cell) {
        
        cell = [[ClickQueryCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellID];
        
    }
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    cell.backgroundColor = BHGrayColor;
    return cell;
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        self.titleLabel = [[UILabel alloc]init];
        [self.contentView addSubview:self.titleLabel];
        self.titleLabel.font = BHFont(15);
        self.titleLabel.textAlignment = NSTextAlignmentLeft;
        self.titleLabel.textColor = BHColor(102,102, 102);
        self.titleLabel.text = @"注:";
        
        [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.leading.equalTo(self.contentView).with.offset(20);
            make.top.equalTo(self.contentView).with.offset(10);
            make.size.mas_equalTo(CGSizeMake(20, 30));
        }];
        
        UIView * lineView = [[UIView alloc]init];
        [self.contentView addSubview:lineView];
        lineView.backgroundColor = BHGrayColor;
        
        [lineView mas_makeConstraints:^(MASConstraintMaker *make) {
            
            make.left.equalTo(self.contentView).with.offset(15);
            make.bottom.equalTo(self.contentView).with.offset(0);
            make.size.mas_equalTo(CGSizeMake(BHscreenW - 15, 1));
        }];
        
        self.starImg = [[UIImageView alloc]init];
        [self.contentView addSubview:self.starImg];
        self.starImg.image = IMG(@"ico_notes");
        
        [self.starImg mas_makeConstraints:^(MASConstraintMaker *make) {
            make.leading.equalTo(self.titleLabel.mas_trailing).with.offset(5);
            make.centerY.equalTo(self.titleLabel).offset(0);
            make.size.mas_equalTo(CGSizeMake(10, 10));
        }];
        
        self.subTitleLabel = [[UILabel alloc]init];
        [self.contentView addSubview:self.subTitleLabel];
        self.subTitleLabel.font = BHFont(15);
        self.subTitleLabel.numberOfLines = 0;
        self.subTitleLabel.textAlignment = NSTextAlignmentLeft;
        self.subTitleLabel.textColor = BHColor(153, 153, 153);
        self.subTitleLabel.text  = @"号为必填选项";
        
        [self.subTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.leading.equalTo(self.starImg.mas_trailing).with.offset(2);
            make.centerY.equalTo(self.titleLabel).with.offset(0);
            make.size.mas_equalTo(CGSizeMake(BHscreenW - 60, 50));
        }];
        
        self.comfirmBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        [self.contentView addSubview:self.comfirmBtn];
        
        [self.comfirmBtn setTitle:@"查询" forState:UIControlStateNormal];
        [self.comfirmBtn setImage:IMG(@"ico_search") forState:UIControlStateNormal];
        [self.comfirmBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        self.comfirmBtn.backgroundColor = Theme_Color;
        self.comfirmBtn.titleLabel.font = BHFont(17);
        
        [self.comfirmBtn setTitleEdgeInsets:UIEdgeInsetsMake(0, 20, 0, 0)];
        
        self.comfirmBtn.layer.cornerRadius = 5;
        self.comfirmBtn.layer.masksToBounds = YES;
        
        [self.comfirmBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.leading.equalTo(self.contentView).with.offset(15);
            make.bottom.equalTo(self.contentView).with.offset(-30);
            make.size.mas_equalTo(CGSizeMake(BHscreenW - 30,40));
        }];




    }
    return self;
}
@end
